<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>
        保养模板-编辑保养部位
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../css/main.css" media="all">
    <script type="text/javascript" src="../../../lib/loading/okLoading.js"></script>
    <link rel="stylesheet" href="../../../css/bootstrap.css">
    <link rel="stylesheet" href="../../../lib/layui/css/layui_2.5.7.css">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .layui-table-page select {
            height: 22px;
        }
    </style>
</head>

<body>
<div>



    <div class="main_box">
        <div class="panel-heading">
            <h2>编辑保养部位</h2>
        </div>
    </div>

    <form class="layui-form x-center">

        <div class="layui-form-pane" style="margin-top: 15px;" id="app">

            <div class="layui-form-item">
                <label class="layui-form-label">部位名称</label>
                <div class="layui-input-block">
                    <input  autocomplete="off"  type="text" class="layui-input" name="name" id="name" placeholder="部位名称" v-model="name">
                    <input  autocomplete="off"  type="hidden" name="id" id="id" v-model="id">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">其他说明</label>
                <div class="layui-input-block">
                    <input  autocomplete="off"  type="text" class="layui-input" name="illustrate" name="illustrate" v-model="illustrate" placeholder="其他说明">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <input  autocomplete="off"  type="text" class="layui-input" name="remark" id="remark" placeholder="备注信息" v-model="remark">
                </div>
            </div>




            <div style="text-align: center" class="layui-form-item">
                <button class="layui-btn" type="button" lay-filter="sub" lay-submit="sub">
                    保存
                </button>
            </div>
        </div>
    </form>



</div>
</body>


<script type="text/javascript" src="../../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../../js/myAjax.js"></script>
<script type="text/javascript" src="../../../js/pub.js"></script>
<script type="text/javascript" src="../../../lib/layui/layui2.5.7.js"></script>
<script type="text/javascript" src="../../../js/vue.min.js"></script>
<!-- <script src="lib/layui/layui.js" charset="utf-8"></script> -->
<script src="../../../js/x-layui.js" charset="utf-8"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer', 'form'], function () {
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element;//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        var form = layui.form;
        okLoading.close($);
    });
</script>


<script>
    var recordId = getQueryVariable("recordId");
    layui.use([ 'form', 'layer'],
        function () {
            var form = layui.form;
            var layer = layui.layer;

            //监听审批提交
            form.on('submit(sub)',
                function (data) {
                    var name = $("#name").val();

                    if(name == ""){
                        layer.msg("请填写部位名称！", {
                            icon: 5
                        });
                        return false;
                    }else{
                        let form = data.field;
                        form.userId=$userId;
                        let request = {
                            url: 'maintenance/elevatorposition/update',
                            data: form,
                            method: "post",
                        };
                        sendRequest(request, (data) => {
                            if (data.code === 0) {
                                layer.alert("操作成功", {
                                        icon: 6
                                    },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                        parent.reload();
                                    });
                            } else {
                                layer.alert(data.msg, {
                                    icon: 5
                                })
                            }
                        });
                        return false;
                    }


                });
        });

    const vm = new Vue({
        el: "#app",
        data: {
            id:null,
            name:null,
            illustrate:null,
            remark:null

        },
        created() {
            var form = layui.form;
            let request = {
                url: 'maintenance/elevatorposition/detail',
                data: {
                    id: recordId,
                    userId:$userId,
                },
                method: "POST"
            }
            sendRequest(request, (res) => {
                this.id=res.data.id;
                this.name=res.data.name;
                this.illustrate=res.data.illustrate;
                this.remark=res.data.remark;

            });

        },
        computed: {},
        methods: {},


    });

</script>
</html>
